{extend name='table'}

{block name="button"}
<!--{if auth("add")}-->
<button data-modal='{:url("add")}' data-table-id="MenuTable" class='layui-btn layui-btn-sm layui-btn-primary'>{:lang('添加商品')}</button>
<!--{/if}-->
{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='goods/index_search'}
    <table id="OplogTable" data-url="{:request()->url()}" data-target-search="form.form-search"></table>
</div>
{/block}

{block name='script'}
<script>
    $(function () {
        $('#OplogTable').layTable({
            even: true, height: 'full',
            sort: {field: 'id', type: 'desc'},
            cols: [[
                {checkbox: true},
                {field: 'id', title: '序号', width: 70, sort: true, align: 'center'},
                {field: 'goods_no', title: '{:lang("商品料号")}'},
                {
                    field: 'goods_pic', title: '{:lang("商品图片")}', width: '7%', align: 'center', templet: function (d) {
                       return laytpl('<div><a target="_blank" data-tips-hover data-tips-image="{{d.goods_pic}}"><i class="layui-icon layui-icon-picture"></i></a></div>').render(d)
                    }
                },
                {field: 'goods_name', title: '{:lang("商品名称")}'},
                {field: 'integral', title: '{:lang("支付积分")}'},
                {field: 'amount', title: '{:lang("支付金额")}'},
                {field: 'goods_type', title: '{:lang("商品类型")}'},
                {field: 'stock', title: '{:lang("库存")}'},
                {field: 'status', title: '{:lang("商品状态")}'},
                {field: 'update_time', title: '{:lang("更新时间")}'},
                {toolbar: '#toolbar', title: '{:lang("操作面板")}',width: 150, align: 'center',fixed: 'right'}
            ]]
        });
    });
</script>
<!-- 操控面板的模板 -->
<script type="text/html" id="toolbar">
   
    {if auth('edit')}
    <a class="layui-btn layui-btn-sm" data-event-dbclick data-title="编辑商品" data-modal='{:url("edit")}?id={{d.id}}'>{:lang('编 辑')}</a>
    {/if}
   
    {if auth('remove')}
    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除商品吗？" data-action="{:url('remove')}" data-value="id#{{d.id}}"  >删 除</a>
    {/if}

</script>
{/block}